// utility.cpp

#include "utility.h"

#include <iostream>
#include <limits>

using namespace std;

int Utility::ArithmeticCalculation(CalcType op, int a, int b)
{
    if (op == ADD)
    {
        return a + b;
    }
    else if (op == MINUS)
    {
        return a - b;
    }
    else if (op == MULTIPLE)
    {
        return a * b;
    }
    else
    {
        if (b == 0)
        {
            cout << "CANNO Divided by 0" << endl;
            return std::numeric_limits<int>::max();
        }
        return a / b;
    }
}

int Multiple::CalcuationResultMultiple(CalcType op, int a, int b, int multiple)
{
    if (multiple != 0)
    {
        int CalcuationResult = calc->ArithmeticCalculation(op, a, b);
        return CalcuationResult * multiple;
    }
    cout << "multiple is  0 !!" << endl;
    return 0;
}
